package com.yzzrjy.controller.commonservlet;


import com.yzzrjy.Service.ConfigService;
import com.yzzrjy.bean.ServerConfigBean;
import com.yzzrjy.util.ResponseUtils;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet(name = "GetServerConfigServlet", value = "/getServerConfig")
public class GetServerConfigServlet extends HttpServlet {
    private ConfigService configService= new ConfigService();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            ServerConfigBean bean = configService.getServerConfig(1);
            if(bean == null){
                ResponseUtils.notFindError(response, "未找到server config");
                return;
            }
            ResponseUtils.success(response, bean);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
